<template>
  <div class="sign_list">
    <div class="search-input">
      <div class="si">
        <el-icon>
          <Search />
        </el-icon>
        <input placeholder="请输入" v-model="dataForm.realName"/>
        <span class="btn" @click="query">搜索</span>
      </div>
    </div>

    <div class="data_list data-list-player">
      <div class="data">
        <div class="item" v-for="(item ,index) in dataList" :key="index">
          <div class="title">{{item.real_name}}</div>
          <div class="attr">参赛单位：{{item.company}}</div>
          <div class="attr">注册时间：{{item.create_date}}</div>
          <div class="btns">
            <el-button type="text" @click="toDetail(item.id)">个人信息</el-button>
            <el-button type="text" @click="toCertificateList(item.real_name, item.id_card)">获奖证书</el-button>
          </div>
        </div>
      </div>

    </div>
  </div>
</template>


<script lang="ts" >
import {ref,toRefs, reactive, defineComponent} from "vue";
import listService from "@/utils/listService";
import router from "@/router";
import baseService from "@/service/baseService";
import {ElMessage} from "element-plus";
import {getCache, setCache} from "@/utils/cache";



export default defineComponent({
  setup() {


    const state = reactive({
      getDataListURL: "/front/fast/user/userList/page?pageSize=10&type=3",
      getDataListIsPage: true,
      deleteURL: "/pay/order",
      deleteIsBatch: true,
      dataForm: {
        id: null,
        status: "",
        name: ""
      }
    });
    return { ...listService(state), ...toRefs(state) };
  },

  data() {
    return {

      isCollapse:1,
      dialogVisible:false,
      isNavCollapse:false,
      showDialogFlag: false,
      evaluationDialogFlag: false,
      updateForm: {
        id: null,
        schoolName: '',
        evaluation: ''
      },
      formLabelWidth: '120px',
      userInfo: ""
    };
  },

  mounted() {
    this.userInfo = getCache('userInfo', { isSessionStorage: true }, {})
  },

  methods: {
    handleEnroll : () => {
      router.push("/enroll/matchEnroll");
    },
    handleEnrollList(){
      router.push("/enroll/enrollList");
    },
    handleCollapse(){
      if (this.isCollapse == 1) {
        this.isCollapse= 2;
        this.isNavCollapse = false;
      } else {
        this.isCollapse = 1;
        setTimeout(() => {
          this.isNavCollapse = true;
        }, 130);
      }
    },



    /**
     * 解除绑定
     */
    handleDelete(id: any) {
      this.dialogVisible = true;
      this.dataForm.id = id;
    },

    /**
     * 确定解除绑定
     */
    handleConfirm() {
      baseService
          .post("/front/spteamuser/delete", {id: this.dataForm.id})
          .then((res) => {
                if (res.code === 0) {
                  this.query();
                  ElMessage.success('解除绑定成功');
                }else{
                  ElMessage.error(res.msg);
                }
                this.dialogVisible = false;
              }
          );
    },
    toDetail(id:any){
      router.push({path:"/match/player_info",query:{id:id }});
    },
    toCertificateList(realName:any, idCard:any){
      const certificate = {
        realName: realName,
        idCard: idCard
      };
      setCache("certificate", certificate, true);
      router.push('/wap/certificate_teacher')
    },
    reset: function () {
      if (this.dataForm) {

      }
    },

  }
});
</script>


<style lang="scss" scoped>
@import "./style.scss";
</style>
